package com.floreantpos.report;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import com.floreantpos.model.StoreItemCompare;

public class StoreItemCompareReportModel extends AbstractTableModel {
	
	private String[] columnNames = {"itemName", "itemCount", "storeName", "total", "storeNumber"};
	private List<StoreItemCompare> items;
	
	public StoreItemCompareReportModel() {
		super();
	}

	public int getRowCount() {
		if(items == null) return 0;
		
		return items.size();
	}

	public int getColumnCount() {
		return columnNames.length;
	}
	
	@Override
	public String getColumnName(int column) {
		return columnNames[column];
	}

	public Object getValueAt(int rowIndex, int columnIndex) {
		StoreItemCompare i = items.get(rowIndex);
		
		switch(columnIndex) {
			case 0:
				return i.getItemName();
				
			case 1: 
				return String.valueOf(i.getItemCount());
				
			case 2:
				return i.getStoreName();
				
			case 3:
				return String.valueOf(i.getTotal());
				
			case 4:
				return String.valueOf(i.getStoreNumber());
		}
		return null;
	}

	public List<StoreItemCompare> getItems() {
		return items;
	}

	public void setItems(List<StoreItemCompare> items) {
		this.items = items;
	}

}
